package com.tedu.day05mybatis.mapper;

import com.tedu.day05mybatis.pojo.Comment;
import com.tedu.day05mybatis.pojo.CommentV01;
import com.tedu.day05mybatis.pojo.CommentV02;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {
    @Insert("INSERT INTO comment(content,user_id ,weibo_id ) VALUES (#{content},#{userId},#{weiboId})")
    int InsertComment(Comment comment);

    @Delete(" DELETE FROM comment WHERE id=#{id}")
    int DeleteCommentById(int id);


    @Update("update comment set content=#{content},user_id userId=#{userId},weibo_id weiboId=#{weiboId}  WHERE id=#{id}")
    int UpdateCommentById(Comment comment);


    @Select("SELECT content,user_id  userId FROM comment WHERE id=#{id}")
    CommentV01 selectCommentById(int id);

    @Select("SELECT id,content,user_id  userId FROM comment WHERE user_id=#{userId}")
    List<CommentV02>selectCommentByUserId(int id);


}
